package ru.fadeev.crammer.data;


/**
 * TestHistoryRecord class represents record for Word test history. It contains
 * information of test date, test type and test result (successful or not).
 * @author Konstantin Fadeyev
 *
 */
public class TestHistoryRecord {
	private long date;
	private int id;
	private boolean successful;
	private int testType;

	
	/**
	 * Constructs a TestHistoryRecord that is initialized with database id,
	 * date, testType and test result.
	 * @param id database id of TestHistoryRecord
	 * @param date date/time in format of System.currentTimeMillis() of test event
	 * @param testType one of TestManager test types
	 * @param successful true, if result of test was positive
	 */
	public TestHistoryRecord(int id, long date, int testType, boolean successful) {
		this.id = id;
		this.date = date;
		this.testType = testType;
		this.successful = successful;
	}
	
	
	/**
	 * Constructs a TestHistoryRecord that is initialized with date, testType and
	 * test result
	 * @param date date of test
	 * @param testType one of TestManager test types
	 * @param successful true, if result of test was positive
	 */
	public TestHistoryRecord(long date, int testType, boolean successful) {
		id = -1;
		this.date = date;
		this.testType = testType;
		this.successful = successful;
	}
	
	
	/**
	 * Returns date/time in format of System.currentTimeMillis() of test event
	 * @return date/time of test event
	 */
	public long getDate() {
		return date;
	}
	
	
	/**
	 * Returns database table id of TestHistoryRecord
	 * @return database table id of TestHistoryRecord
	 */
	protected int getId() {
		return id;
	}
	
	
	/**
	 * Returns test type of test event 
	 * @return test type of test event 
	 */
	public int getTestType() {
		return testType;
	}
	
	
	/**
	 * Returns result of test event
	 * @return true, if result of test was positive
	 */
	public boolean isSuccessful() {
		return successful;
	}
	
	
	/**
	 * Sets new date/time in format of System.currentTimeMillis() of test event
	 * @param date new date/time of test event
	 */
	protected void setDate(long date) {
		this.date = date;
	}
	
	
	/**
	 * Sets new database table id of TestHistoryRecord
	 * @param id new database table id of TestHistoryRecord
	 */
	protected void setId(int id) {
		this.id = id;
	}
	
	
	/**
	 * Sets new result of test event
	 * @param successful true, if result of test was positive
	 */
	protected void setSuccessful(boolean successful) {
		this.successful = successful;
	}
	
	
	/**
	 * Sets new test type of test event 
	 * @param testType one of TestManager test types
	 */
	protected void setTestType(int testType) {
		this.testType = testType;
	}	
}
